const Mock = require("mockjs");
/* 
  mock方法 mock接口
  Mock.mock(path[,type],data)

  产生随机数语法
  量词 （定义字段长度或大小）
  "字段名|量词":值
    数组
      "arr|10" // 产生长度为10数组
      "arr|10-20" // 产生长度为10-20长度数组
    字符串 也是一样
      "str|2": "☆☆" // ☆☆☆☆
      "arr|2-3":"☆☆" // ☆☆☆☆   --  ☆☆☆☆☆☆
    数字 一定是范值  修饰大小
    "num|10-20": 10
    递增 一般用于字段id
      "id|+n"   "id|+1"
  占位符： 定义 产生不同类型的 随机数 
    "字段": "@占位符"


        
      Basic
        boolean, natural, integer, float, character, string, range
              @natural(100,1000)    @integer(100,1000)
      Date
        date, time, datetime, now
      Image
        img, dataImage
          调用时可以加括号 "@img(尺寸,颜色,文字)"    "@img('100x100', '@color', '小甜甜')"
      Color
        color, hex, rgb, rgba, hsl
      Text
        paragraph, sentence, word, title, cparagraph, csentence, cword, ctitle
      Name
        first, last, name, cfirst, clast, cname
      Web
        url, domain, protocol, tld, email, ip
      Address
        region, province, city, county, zip
      Helper
        capitalize, upper, lower, pick, shuffle
*/
Mock.mock("/api/itemLists", "post", {
  code: 200,
  msg: "success",
  "data|10": [
    {
      "id|+1": 1,
      itemName: "@ctitle",
      itemPrice: "@natural(100,1000)",
      itemDesc: "@cparagraph",
      itemImg: "@img('100x100', '@color', '小甜甜')",
      itemStatus: "@integer(0,1)",
      itemCreateTime: "@datetime",
      itemUpdateTime: "@datetime",
      itemSellCount: "@integer(0,1000)",
    },
  ],
});
